import { request } from "@/utils/request";
import type { CodeData, CodeType, PatientDataType, PatientInfoList, PatientUserType, UserType} from '@/types/user'
//登录--密码登录
export const LoginPassword =(data:object)=>{
  return request<UserType>('/login/password',
    'POST',data
  )
}
//获取手机验证码
export const codeMsg =(mobile:string,type:CodeType)=>{
  return request<CodeData>('/code','GET',{mobile,type})
}

//登录--手机验证码登录
export const LoginMsMCode =(mobile:string,code:string)=>{
 return request<UserType>('/login','POST',{mobile,code})
}
//注册
export const RegData =(mobile:string,code:string,password:string)=>{
return request('/register','POST',{mobile,code,password})
}
//我的-获取个人用户信息
export const UserInfoList =()=>{
  return request<PatientUserType>('/patient/myUser','GET')
}

//问诊-查询患者列表信息
export const patientInfoList=()=>request<PatientInfoList>('/patient/mylist')

// 问诊-添加患者信息
export const addPatientMsg =(patient:PatientDataType)=>{
  return request('/patient/add','POST',patient)
}

//问诊-编辑患者信息
export const editPatientMsg =(data:PatientDataType)=>{
  return request('/patient/update','PUT',data)
}
//问诊-删除患者信息
export const delPatientMsg =(id:string)=>{
  return request(`/patient/del/${id}`,'DELETE')
}

//消息通知-所有未读数量
export const unRead = ()=>{
  return request<number>('/patient/message/unRead/all')
}

//登录--三方登录--qq三方登录
export const loginQQ = (openId:string)=>{
  return request<UserType>('/login/thirdparty','POST',{openId,source:'qq'})
}

//登录--绑定用户新-三方登录绑定手机号
export const loginMobile = (data:{mobile:string,code:string,openId:string})=>{
  return request<UserType>('/login/binding','POST',data)
}